/*
 * @Author: your name
 * @Date: 2021-02-06 17:01:01
 * @LastEditTime: 2022-07-28 17:53:47
 * @LastEditors: Please set LastEditors
 * @Description: 存储聊天数据 和对 聊天内容进行处理
 * @FilePath: \vue-movie\src\store\modules\chat\chat.module.js
 */

const chatMo = {
  namespaced: true,
  state: () => ({
    chatListData: [],
    chatFlag: false
  }),
  getters: {
    getChatList (state) {
      return state.chatListData
    },
    getchatFlag (state) {
      return state.chatFlag
    }
  },
  mutations: {
    initChatList (state) { // 清空聊天
      state.chatListData = []
    },
    initChatflag (state) { // 刷新数据
      console.log('刷新数据');
      state.chatFlag = !state.chatFlag
    },
    addChatList (state, obj) { // 增加聊天
      state.chatListData.push(obj)
    },
    remoteChatList (state, index) { // 删除 只支持一条一条删除
      state.chatListData.splice(index, 1)
    }
  },
  actions: {

  }
}

export default chatMo